<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('工厂')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-factory_id" onfocus="handleChange1()" data-rule="required" data-source="factory/index" class="form-control selectpage" name="row[factory_id]" data-field="title"  type="text" value="{$row.factory_id|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('产品')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-product_id" v-model="form.select2" data-rule="required" data-source="productname/indexselect" class="form-control selectpage" name="row[product_id]" type="text" value="{$row.product_id|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Cost_name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-cost_name" class="form-control" name="row[cost_name]" type="text" value="{$row.cost_name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('计费方式')}:</label>
        <div class="col-xs-12 col-sm-8">
            <!--<input id="c-damage_reason" class="form-control" name="row[damage_reason]" type="number" value="">
           -->
            <div class="radio">
                {foreach name="typeList" item="vo"}
                <label  for="row[type]-{$key}"><input onfocus = "cs()" id="row[type]-{$key}" name="row[type]" type="radio" value="{$key}" {in name="key" value="$row.type"}checked{/in} /> {$vo}</label>
                {/foreach}
            </div>


        </div>
    </div>
    <div class="form-group" id = "cost_money">
        <label class="control-label col-xs-12 col-sm-2">{:__('工厂收取费用')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-cost_money" class="form-control" step="0.01" name="row[cost_money]" type="number" value="{$row.cost_money|htmlentities}">
        </div>
    </div>
    <div class="form-group" id = "real_money">
        <label class="control-label col-xs-12 col-sm-2">{:__('心喜阅费用')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-real_money" class="form-control" step="0.01" name="row[real_money]" type="number" value="{$row.real_money|htmlentities}">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
        </div>
    </div>
</form>
<script type="text/javascript">
    csst();
    function csst () {
        console.log("进入方法");
        var popVal = $("#c-type").val();
        //let id = $("#damage_reason").val();
        // popVal = $(this).val();
        // alert(popVal);
        console.log("进入方法","number ="+popVal);
        if (popVal === '1') {
            //alert("333")

            // 弹窗公告
            $("#cost_money").addClass('hide');
        } else {
            // 活动公告
            $("#c-cost_money").val(0);
            $("#cost_money").removeClass('hide');
        }

    }
    function cs () {
        console.log("进入方法");
        var popVal = $("input[type=radio][name='row[type]']:checked").val();
        //let id = $("#damage_reason").val();
        // popVal = $(this).val();
        // alert(popVal);
        console.log("进入方法","number ="+popVal);
        if (popVal === '1') {
            //alert("333")

            // 弹窗公告
            $("#cost_money").addClass('hide');
        } else {
            // 活动公告
            $("#c-cost_money").val(0);
            $("#cost_money").removeClass('hide');
        }

    }
    function handleChange1(){
        console.log("进入ddd方法");
        $("#c-product_id").val('');
    }
</script>
